#ifndef _SETTING_H_
#define _SETTING_H_

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __cplusplus
}
#endif

#include <thread>
#include <mutex>
#include "setting_gui.h"
#include <string>
#include <string.h>

using namespace std;

class Setting;

class Setting 
{
public:
struct sysconfig
{
    int brightness;         //保存亮度
    int volume;             //保存音量
    int auto_position;      //是否自动定位
    string mainbg_file;     //主界面壁纸文件
    string host_ip;         //pc resource应用主机ip地址
    string weather_appid;           //天气appid
    string weather_appsecret;       //天气appsecret
    string weather_city;                //天气城市
};  

private:
    string connected_ssid;      //已连接的wifi ssid
    std::thread *pthread;       //数据处理线程
    bool thread_exit_flag;      //指定线程退出标记

public:
    Setting(void (*exit_cb)(lv_event_t*), mutex &UIMutex);
    ~Setting();

    bool readconfig(sysconfig &config);
    void saveconfig(sysconfig &config);
    bool wifiSearch(void);
    string &updateConnection(void);
    bool getNetInfo(void);

    const bool getExitFlag() const { return thread_exit_flag; }
public:
    
};

#endif